import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sph_driver/FindGoods/SubmitGoodsComplaint.dart';

import '../AppConfig/Config.dart';
import '../AppConfig/RouteAct.dart';
import '../http/NoLoadingGetApi.dart';

class ComplaintGoodsSecond extends StatefulWidget {
  const ComplaintGoodsSecond({super.key, required this.index, required this.dataMap, required this.parentId});
  final int index;
  final Map dataMap;
  final String parentId;
  @override
  State<ComplaintGoodsSecond> createState() => _ComplaintGoodsSecondState();
}

class _ComplaintGoodsSecondState extends State<ComplaintGoodsSecond> {
  List seasonList1=["该货物为违禁品：武器、弹药、爆炸物品、剧毒物品、麻醉剂、放射性物品等","该货物为危险品：具有爆炸、易燃、毒害、感染、腐蚀等危险特性的货物",
  "该货物为限运品，例如：烟草、垃圾、不明液体或不明粉剂等","其他：拉人"];
  List seasonList2=["货主发布货源信息骂人","实际无货，是货主发布的广告"];
  List seasonList3=["线上已支付","货主让我线下再支付","线上未支付，货主让我线下支付"];
  List seasonList4=["实际无货","有货但发布多条相同货源霸屏"];
  List seasonList5=["装卸货时间/地址/方式等变更","货物信息与实际不符","平台定位/导航不准"];
  List seasonList6=["货主对车型有特殊需求如车辆改装等","货源中未提到禁区问题，但实际有禁区","平台导航不显示禁区，但实际有禁区"];
  List seasonList7=["其他举报"];
  List dataList=[];
  void getPageAction(){
    NoLoadinggetApiManager.getData(
      context,
      "api/system/dev/dict/list",
      {'category':'BIZ','parentId':widget.parentId},
          (responseData)  {
        setState(() {
          dataList=responseData['data'];
        });

      },
    );
  }
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getPageAction();
  }
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor:Color.fromRGBO(248, 248, 248, 1),
      appBar: AppBar(
        title: Text("投诉",style: TextStyle(fontWeight: FontWeight.w300,fontSize: 16.sp),),
        centerTitle: true,
        backgroundColor: Colors.white,
      ),
      body: ListView(
        children: [
          Container(
            margin: EdgeInsets.only(left: 12.w,top: 8.h),
            child: Text("请选择投诉原因",style: TextStyle(color: Colors.black,fontSize: 16.sp,),),
          ),
          Container(
            margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
            padding: EdgeInsets.only(left: 8.w,right: 8.w,bottom: 8.h),
            height: dataList.length*50.h,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(Radius.circular(10))),
            child:  ListView.builder(
              itemCount:dataList.length,
              itemBuilder: (context, index) {
                return GestureDetector(
                  child:Container(
                    padding: EdgeInsets.only(top: 8.h),
                    child: Column(
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Container(
                              width: screenSize.width-80.w,
                              child:
                              Text(dataList[index]['dictLabel'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ),
                            Icon(Icons.arrow_forward_ios,color: MyColors.hintColor,),
                          ],
                        ),
                        if(index!=dataList.length-1)
                          Divider(height: 6.h,color: MyColors.backgreyColor,),
                      ],
                    ),
                  ) ,
                  onTap: (){
                    Navigator.push( context, FadeRoute(page:SubmitGoodsComplaint(dataMap:widget.dataMap, parentId: dataList[index]['id'],)));
                  },
                );


              },
            ),
          ),
        ],
      ),
    );
  }
}
